package chapter08;import java.util.concurrent.CyclicBarrier;/** * 功能: CyclicBarrier 源码分析. * 1、所有线程都到达屏障后，先执行一个特殊的任务而已 * * @author Fire Fish * @since 2022-08-09 17:42:56 */public class CyclicBarrierTest2 {    static CyclicBarrier c = new CyclicBarrier(2, new A());    public static void main(String[] args) {        new Thread(new Runnable() {            @Override            public void run() {                try {                    c.await();                } catch (Exception e) {                }                System.out.println(1);            }        }).start();        try {            c.await();        } catch (Exception e) {        }        System.out.println(2);    }    static class A implements Runnable {        @Override        public void run() {            System.out.println(3);        }    }}